public class Test {
    public static void main15(String[] args) {
        String str = " hello world " ;
        System.out.println("["+str+"]");
        System.out.println("["+str.trim()+"]");
    }
    public static void main(String[] args) {
        String str = "hello world";
        System.out.println(str.substring(5));
        System.out.println(str.substring(0, 5));
    }
    public static void main13(String[] args) {
       String str = "name=zhangsan&age=18" ;
       String[] result = str.split("&");
        for (int i = 0; i < result.length ; i++) {
            String[] str2 = result[i].split("=");
            System.out.println(str2[0]+" = "+str2[1]);
        }
    }
    public static void main12(String[] args) {
        String str = "hello world";
        String[] result = str.split(" ",2) ;
        for (String s : result) {
            System.out.println(s);
        }
    }
    public static void main11(String[] args) {
        String str = "hello world hello china";
        String[] result = str.split(" ") ; // 按照空格拆分
        for(String s: result) {
            System.out.println(s);
        }
    }

    public static void main10(String[] args) {
        String str = "helloworld" ;
        System.out.println(str.replaceAll("l", "_"));
        System.out.println(str.replaceFirst("l", "_"));
    }
    public static void main9(String[] args) {
            String s = String.format("%d-%d-%d", 2025, 10,23);
            System.out.println(s);

    }
    public static void main8(String[] args) {
            String s = "hello";
            char[] ch = s.toCharArray();
            System.out.println(ch);
            String s2 = new String(ch);
        System.out.println(ch);
    }
    public static void main7(String[] args) {
        String s1 = "hello";
        String s2 = "HELLO";
// ⼩写转⼤写
        System.out.println(s1.toUpperCase());
// ⼤写转⼩写
        System.out.println(s2.toLowerCase());
    }
    public static void main6(String[] args) {
        int data1 = Integer.parseInt("6666");
        double data2 = Double.parseDouble("88.88");
        int data3 = Integer.valueOf("6666");
        System.out.println(data1);
        System.out.println(data2);
        System.out.println(data3);

    }
    public static void main5(String[] args) {
// 数字转字符串
            String s1 = String.valueOf(1234);
            String s2 = String.valueOf(12.34);
            String s3 = String.valueOf(true);
            String s4 = String.valueOf(new Student(20 ,"whw"));
            System.out.println(s1);
            System.out.println(s2);
            System.out.println(s3);
            System.out.println(s4);
            System.out.println("=================================");
    }
    public static void main4(String[] args) {
        String str = "hello bit";
        System.out.println(str.lastIndexOf("bit"));
    }
    public static void main3(String[] args) {
        String str = "hello bit";
        System.out.println(str.lastIndexOf('b'));
    }
    public static void main2(String[] args) {
        String str = "hello world";
        System.out.println(str.indexOf("world"));


    }
    public static void main1(String[] args) {
        String str = "abcdefg";
        char ch = str.charAt(2);
        System.out.println(ch);
    }
}
